
chrome.extension.onRequest.addListener(
  function(request, sender, sendResponse) {
    if (request.action == "get_text")
    {
		var text = '' + getSelection();
		if(text == '')
		{
			text = document.location.href;
		}
		sendResponse({text: text});
    }
  });
